import { defineStore } from "pinia";
import { ref } from "vue";

export const useAuthorizationCodeStore = defineStore('authorizationCodeManager', () => {
    const authorizationCode = ref<string>('');
    
    function setAuthorizationCode(userToken: string) {
        authorizationCode.value = userToken;
    }
    function getAuthorizationCode() {
        return authorizationCode.value;
    }
    function getAuthorizationCodeToken() {
        return "token " + authorizationCode.value;
    }
    function removeAuthorizationCode() {
        return authorizationCode.value = '';
    }
    return { authorizationCode, setAuthorizationCode, getAuthorizationCode, removeAuthorizationCode, getAuthorizationCodeToken }
}, {
    persist: true,
},)